/**
 * 充值列表
 */

var pay = new Object({
    table:null,
    init:function(){
        if(null != this.table)
            return;
        this.queryInfo();
        this.bindEvent();
    },
    queryInfo:function(){
        this.table = $('#tb_pay_list').bootstrapTable({
            url: contextPath + '/pay/listData.json',
            responseHandler: function (res) {
                return res.data;
            },
            queryParams: function (params) {
                return params;
            },
            pagination: true,
            pageList: '[10,20,50,100]',
            //showColumns: true,
            showRefresh: true,
            showToggle: true,
            //showPaginationSwitch:true,
            sidePagination: 'server',
            //striped:true,
            sortable: false,
            height: 700,
            search: true,
            searchAlign: 'left',
            idField: 'id',
            uniqueId: 'id',
            //singleSelect: true,
            clickToSelect: true,
            columns: [{
                field: 'player.nickname',
                title: '玩家名称',
                width: 100
            }, {
                field: 'amount',
                title: '金额(元)',
                width: 80
            },  {
                field: 'item.name',
                title: '购买道具',
                width: 100
            }, {
                field: 'orderTime',
                title: '下单时间',
                width: 200,
                formatter:function(value,row,index){
                    return (new Date(value)).Format("yyyy-MM-dd hh:mm:ss");
                }
            }, {
                field: 'payTime',
                title: '支付时间',
                width: 200,
                formatter:function(value,row,index){
                    if(value != null) {
                        return (new Date(value)).Format("yyyy-MM-dd hh:mm:ss");
                    }
                    return "";
                }
            }, {
                field: 'orderStatus',
                title: '状态',
                width: 80,
                formatter:function(value,row,index){
                    if(value == 1){
                        return '待支付';
                    } else if(value == 2) {
                        return '支付成功';
                    } else if(value == 3) {
                        return '支付失败';
                    } else if(value == 4) {
                        return '支付取消';
                    } else{
                        return value;
                    }
                }
            }, {
                field: 'description',
                title: '描述',
                width: 100
            }, {
                field: 'payType',
                title: '支付方式',
                width: 40,
                formatter:function(value,row,index){
                    if(value == 1){
                        return '微信';
                    } else if(value == 2) {
                        return '支付宝';
                    }  else{
                        return value;
                    }
                }
            }, {
                field: 'payPlatform',
                title: '支付平台',
                width: 40
            }, {
                field: 'tradeNo',
                title: '订单号',
                width: 40
            }, {
                field: 'transId',
                title: '交易流水号',
                width: 100
            }, {
                field: 'transState',
                title: '交易结果状态',
                width: 40,
                formatter:function(value,row,index){
                    if(value == 0){
                        return '交易失败';
                    } else if(value == 1) {
                        return '交易成功';
                    }  else{
                        return value;
                    }
                }
            }, {
                field: 'transResult',
                title: '交易结果描述',
                width: 100
            }]
        });
        $('.search input').attr("placeholder", "玩家名称");
    },
    bindEvent: function () {
    }
});